package com.example.bawolf.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.regex.Pattern;

/**
 * @author zhougf
 * @version 1.0
 * @date 2020/03/05
 */
@RestController
public class TestController {

    @RequestMapping(value = "/v1/sendMessage/{id}", method = RequestMethod.GET)
    public String test(@PathVariable("id") Integer id){

        try{
            System.out.println("进入方法");
            if(id == 4) {
                id = null;
            }
//            String test = String.valueOf(id);
            String test = id.toString();
            if(!StringUtils.isEmpty(test)) {
                return test;
            }
        } catch (Exception e) {
            throw e;
//            e.printStackTrace();
//            System.out.println("发生内部异常");
        }
        return "8";
    }

    public static void main(String[] args) {
        Pattern parent = Pattern.compile("(\\d)\\1");
//        Pattern parent1 = Pattern.compile("^[0-9]{6}$");
        System.out.println(parent.matcher("22").matches());
    }
}
